home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!ts13-05
- From: rmorin@inforamp.net (Randy Charles Morin)
- Newsgroups: comp.lang.c++
- Subject: Re: Help Please
- Date: Sat, 30 Mar 96 20:46:02 GMT
- Organization: MiddleWorld SoftWare
- Message-ID: <4jk6j3$l58@sam.inforamp.net>
- References: <4ji7eo$kgm@daisy.flex.com.au>
- NNTP-Posting-Host: ts13-05.tor.istar.ca
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- In article <4ji7eo$kgm@daisy.flex.com.au>, cobweb@flex.com.au (Tony L) wrote:
- >main()
- >{
- > char him[] = "Keating";
- ..
- > scanf(" %s", last2);
- > if (last2 == him)
- > { printf("you have voted for Paul Keating!"); }
-
- You are are comparing a char * to a char *. This means you are
- comparing a pointer to another pointer. That is, the address
- of the string, not the string. You want to use the string
- function strcmp.
- if (strcmp(last2, him)==0)
- { printf("you have voted for Paul Keating!"); }
-
- Hope I've helped.
-
- Agrivar
-
-
- Agrivar
-
- aka Randy Charles Morin
- MiddleWorld SoftWare
- Canada: 1-800-363-3780
- Other: 905-279-2087
-